<template>
  <div class="index">
    <!-- <headbox></headbox> -->
    <billbox></billbox>
    <div class="indexbox">
      <bigbanner bheight="360px" :imgarray="imginfo.bigBannerList"></bigbanner>
    </div>
    <footbox></footbox>
  </div>
</template>
<script>
import { imglistServ } from "@/api/index";
import headbox from "@/components/public/headbox";  //公共头部
import bigbanner from "@/components/index/bigbanner";  //公共头部
import billbox from "@/components/public/billbox";  //公共菜单
import footbox from "@/components/public/footbox";  //公共尾部
export default {
  components: { 
      headbox,
      bigbanner,
      billbox,
      footbox,
  },
  data() {
    return {
      imgurl:this.globalData.imgurl,   //网站静态图片路径
      wzinfo: {
        block1:[],
        block2:[],
        block3:[],
      },  //文章信息
      imginfo:{
        bigBannerList:[],  //首页轮播
        r2BannerList:[],  //第二行 轮播
        r3Banner01List:[], //分类轮播 1
        r3Banner02List:[], //分类轮播 2
        newsImgList:[], //新闻图片链接
        blogrollImgList:[], //友情图片链接
      }, //图片综合信息
      btnlist:{
        loginBox:[],  //按钮列表
      },
      btnone:{},  //独立按钮1
      btntwo:{},  //独立按钮2
      btnlist2:[],  //按钮链接2
      friendlist:[],  //友情链接
    };
  },
  created () {
    //获取文章列表
    this.getwenzhang();
    //获取图片列表
    this.getimglist();
    //获取按钮链接
    this.getbtnlist();
    //获取友情链接
    this.getfriendlink();
  },
  mounted () {
    this.$nextTick(() => {
    })
  },
  methods: {
    //一些基本配置方法————————————————————————————————————————————————————————————————————————————
    //获取文章列表
    getwenzhang: function(e){
      var that = this;
      var data = {
      }
      that.$http('home/getHometText',data,'post').then(function (res) {
          if(res.code == 200){
            that.wzinfo.block1 = res.result.block1;
            that.wzinfo.block2 = res.result.block2;
            that.wzinfo.block3 = res.result.block3;
          }else{
            that.$notify.error({
              title: "系统提示",
              message: res.message
            });
          }
      }).catch(function (error) {
          console.log("请求失败")
          console.log(error)
      })
    },
    //获取图片列表
    getimglist: function(e){
      var that = this;
      var data = {
        ceshs:1,
        ceshsss:2,
      }
      imglistServ(data).then(res => {
        if(res.code == 200){
          console.log("请求成功")
          that.imginfo = res.result;
        }else{
          that.$notify.error({
            title: "系统提示",
            message: res.message
          });
        }
      });
      // that.$http('home/getHomePictureList',data,'post').then(function (res) {
      //     if(res.code == 200){
      //       that.imginfo = res.result;
      //     }else{
      //       that.$notify.error({
      //         title: "系统提示",
      //         message: res.message
      //       });
      //     }
      // }).catch(function (error) {
      //     console.log("请求失败")
      //     console.log(error)
      // })
    },
    //获取按钮列表
    getbtnlist: function(e){
      var that = this;
      var data = {
      }
      that.$http('home/getHomeButtonList',data,'post').then(function (res) {
          if(res.code == 200){
            that.btnlist = res.result;
            //数组重构
            that.btnone = that.btnlist.loginBox[0];  //按钮1
            that.btntwo = that.btnlist.loginBox[1];  //按钮2
            that.btnlist2 = [];  //先重置空
            for (let i = 2; i < 6; i++){
                that.btnlist2.push(that.btnlist.loginBox[i]);
            }
          }else{
            that.$notify.error({
              title: "系统提示",
              message: res.message
            });
          }
      }).catch(function (error) {
          console.log("请求失败")
          console.log(error)
      })
    },
    //获取图片列表
    getfriendlink: function(e){
      var that = this;
      var data = {
      }
      that.$http('home/getHomeDanWeiLink',data,'post').then(function (res) {
          if(res.code == 200){
            that.friendlist = res.result;
          }else{
            that.$notify.error({
              title: "系统提示",
              message: res.message
            });
          }
      }).catch(function (error) {
          console.log("请求失败")
          console.log(error)
      })
    },
    //接口系列结束————————————————————————————————————————————————————
  }
};
</script>
<style lang="scss" scoped>
.index{
  width: 100%;
  .indexbox{
    width: 1200px;
    min-height: 1000px;
    margin: 0 auto;
    overflow: hidden;
  }
}

.toplength{
  margin-top: 24px;
}
</style>

